package com.hnjd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnjd.admin.Student;
import com.hnjd.mapper.StudentMapper;
import com.hnjd.mapper.TeacherMapper;
import com.hnjd.admin.Teacher;
import com.hnjd.service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements ITeacherService {
    private TeacherMapper teacherMapper;

    @Autowired
    public void setTeacherMapper(TeacherMapper teacherMapper) {
        this.teacherMapper = teacherMapper;
    }

    @Override
    public int login(String username, String password) {
        QueryWrapper<Teacher> teacherQueryWrapper = new QueryWrapper<>();
        teacherQueryWrapper.eq("username", username).eq("password", password);
        Teacher teacher = teacherMapper.selectOne(teacherQueryWrapper);
        return teacher!=null?1:0;
    }
}
